package com.cqc.aiyagril2.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by ${cqc} on 2018/1/14.
 * 主页ViewPager的adapter
 */

public class HomeFragAdapter extends FragmentPagerAdapter {

    private List<Fragment> frags;
    private List<String> titles;

    public HomeFragAdapter(FragmentManager fm, List<Fragment> frags, List<String> titles) {
        super(fm);
        this.frags = frags;
        this.titles = titles;
    }


    @Override
    public Fragment getItem(int position) {
        return frags.get(position);
    }

    @Override
    public int getCount() {
        return frags.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }

}
